﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="StateValueRangeBehaviour.cs" company="José Miguel Torres">
//   desarrolloMobile.NET 2012
// </copyright>
// <summary>
//   Defines the StateValueRangeBehaviour type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace devMobile.Controls.Status.BuiltInRangeBehaviours
{
    using System.Collections.Generic;
    using System.Windows.Media;

    /// <summary>
    /// </summary>
    public static class StateValueRangeBehaviour
    {

        public static IEnumerable<RangeBehaviourItem> CreateThreeStates(int maxValue)
        {
            return new List<RangeBehaviourItem>
                {
                    new RangeBehaviourItem { FromValue = 0, ToValue = (int)(0.33 * maxValue), SignalColor = new SolidColorBrush(Colors.Red) },
                    new RangeBehaviourItem
                        {
                            FromValue = (int)(0.33 * maxValue), ToValue = (int)(0.66 * maxValue), SignalColor = new SolidColorBrush(Colors.Yellow) 
                        },
                    new RangeBehaviourItem
                        {
                            FromValue = (int)(0.66 * maxValue), ToValue = maxValue, SignalColor = new SolidColorBrush(Colors.Green) 
                        }
                };
        }

        public static IEnumerable<RangeBehaviourItem> CreateFourStates(int maxValue)
        {
            return new List<RangeBehaviourItem>
                {
                    new RangeBehaviourItem
                        {
                            FromValue = 0, ToValue = (int)(0.25 * maxValue), SignalColor = new SolidColorBrush(Colors.Red)
                        },
                    new RangeBehaviourItem
                        {
                            FromValue = (int)(0.25 * maxValue), ToValue = (int)(0.50 * maxValue), SignalColor = new SolidColorBrush(Colors.Orange) 
                        },
                    new RangeBehaviourItem
                        {
                            FromValue = (int)(0.50 * maxValue), ToValue = (int)(0.75 * maxValue), SignalColor = new SolidColorBrush(Colors.Yellow) 
                        },
                    new RangeBehaviourItem
                        {
                            FromValue = (int)(0.75 * maxValue), ToValue = 100, SignalColor = new SolidColorBrush(Colors.Green) 
                        }
                };
        }

        public static IEnumerable<RangeBehaviourItem> CreateThreeStates()
        {
            return StateValueRangeBehaviour.CreateThreeStates(100);
        }

        public static IEnumerable<RangeBehaviourItem> CreateFourStates()
        {
            return StateValueRangeBehaviour.CreateFourStates(100);
        }
    }
}
